Fixing the merge errors. Still have bug that need to be fixed.