added it all inside a deviceready function