Addresses #128

#128 and some other stuffs, see discussion in issue ticket.