made simpler, fixed a bug