added comments and made sure it works in android 4.4