Refactor moving elements to be more generalizable