refactored to make it a real control