Stability fixes

-Fixed a number of stability and lock issues.
-Cleaned up old code

Signed-off-by: Bennie Leonard <bennie.leonard@gmail.com>