Fixed defects and updated direction generator