now working smoothly in stand-alone mode