Cleaned up, separated stuff into separate files. Added integral behavior.