- moved and renamed some functions