refactor the whole project so that more object-oriented now