Updating directory, adding some optimizations