some revisions thanks to IRC