Major refactoring+ bug fixes

Code is a bit better now