Fix merge, and implement ajax

Fixed a bug in the .merge function and finished implementation on the
ajax function.