Restructure of code

Deleted redundant methods, created new methods.