Moved logic over to engine class