Issue #77: refactored lockscreen.js

@timdream, could you review this? thank you!