Added the merge functionality
Added comments and fixed bug on append()