Thilina, please move all your functions from tbl_change.php to libraries/insert_edit.lib.php. I suspect that other functions from refactoring tbl_replace.php and tbl_replace_fields.inc.php will go there as well.