Applied freider's change, fix whitespace, refactor

Added partition_spec and table_location as static methods,
changes 2 spaces to 4 spaces for indenting.