cleaned up load function; minor edits