cleaned up style and added new functions