Functional refactoring

Refactored parts of code to make them more functional (as in functions). Added circle functionality. Fixed line implementation.