removed code duplication and fixed meaning of length var
added support for center alignment + test
Merge pull request #13 from danyshaanan/master

Added support for center alignment