Finally divided stuff into methods and classes