Fixed Sleep Issue

Did some code cleanup, and fixed the issue of phone sleeping preventing
lockout. Also changed timelimit from 10 min, to 5.