Attempted to get rid of some warnings. Couple of bug fixes