Cleaned up code per soffes for issue #2