works but need to implement error proof