fixed some bugs and completed lockout feature