added code from pc version