Fixed issues throughout code.