tweaks
fixed off-by-one error
tweaks and uglification
more messification