Major changes

ask me if you dont understand the code