Cleaned up code & streamlined JS