Cleaned up and made simpler to understand. Added readme