Refactor some uneeded code