Minor code fixes, works