Fixed a bug, but still needs cleaning up. Troy?