added set functions, refactored code