Some code refactoring; srand added
Added .DS_Store to .gitignore