Thoroughly improve code, structure, design and security