Added day of week code and reworked js code