Cleaned up code see #88