Migrated functions out of alias file and general cleanup.