routes now add mode parameter and fixed code style