final version with methods for full select statement