Customized and trimmed down for com.bitwalker projects