Smart admin setup

This is not quite done, but it contains some good stuff so I'm going to request a pull to master now