Cleaned up path code a bit