orginize the code and make it more oop