Cleaner, more objected oriented way of implementing