BF: Small bug fixes in utils, cleaned up a little