Moved methods to classes.
Fixed stupid constants problems.