updated: with small tweaks and fixes