Refactor classes, Add comments, implement abstract methods, and add factory method for engine selection