Implementation for SelectAll and some refactoring
Added test for SelectAll