Implemented Ajax functionality