cleaning up and commenting js