Fixed problems of resolving path, and prettifed with PEP8