Cleaned up code. Removed extra functions and variables from Maincomponent.