Cleaned up part of ls code