now it's written in more Object Oriented way