code cleanup
added OOP functions