implement push and improve error handling