change return type of resolveAs method
Beautify code