Divide script into proper objects