Implemented own code for creating surface, remove unused code