making field attributes accessible
added some minor comments, cleaned up some code