Added dock mode. Fixed bugs.