Misc clean enh

Misc clean and little enh. or fixes.

is it ok on android?