Flipping ifdef logic, and addressing style issues.
Added Apache license block.