ls_remote: cleaned up code, added support for commands other than tags, added test