Initial commit refactored from my old works