Move some code around and add a few aliases