cleaned up snippet