Fixed #15

Fixed #15, also reformatted code to follow PSR-2.