working ver. (but #UGLY code)

working ver. with 88 .. 600+ WRNs and Run-Time logic mistakes.