Updated to comply to the newest API version