Moved control stuff to new file