lots of changes, better structure