Complete and tested without comments

Need to comment and cleanup code.