Reverted optimization flag. Cleaned code, including factoring out repeated calls to thread_current().