tidy up. removed some functions not needed anymore