fixing bugs and implementing ajax on homepage