cleaned up control functionality