organizing functions and cleaning commented code
creating init function