Pruned the code a bit