working complete functionality