added Frame class and refactored