bug fixed with select query
completed high level implementation