Added isOptSrvRunning method to loptsrv, moved implementation of Lock class to loptsrv.
Also improved error messages.