upadated with working pointers