Removed some useless code

Still need to refactor a bit to make it more generally applicable