Format State Code

Change tabs to spaces
Move register states method