Implement ability to add subusers

Also fixes various bugs and has code improvements.