Updated code from tapkee