refactored prepared statements