changed class names and moved some functions to another class.