smaller and fixed a few bugs