Supports Pressing Home and Back button

Major changes in CustomThread