Factored out rectangle calculations, changed to unix line endings
Added she-bang