Cleaned up per jay's suggestions