refactored main interface