Implemented cpu registers and code refactor