removing trial and commented code
fixes #1, fixes #4, adding comments and improving code readability